package br.com.gaacorp.sai.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

@Entity
@Table(name = "tab_answer")
public class Answer extends BaseObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5362959188315647039L;
	private Long answerId;
	private Date date;
	private Question question;
	

	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof Answer)) {
			return false;
		}

		final Answer answer = (Answer) o;

		return !(answerId != null ? !answerId.equals(answer.answerId)
				: answer.answerId != null);
	}


	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getAnswerId() {
		return answerId;
	}

	public Date getDate() {
		return date;
	}

	public Question getQuestion() {
		return question;
	}


	public int hashCode() {
		return (answerId != null ? answerId.hashCode() : 0);
	}

	public void setAnswerId(Long answerId) {
		this.answerId = answerId;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public void setQuestion(Question question) {
		this.question = question;
	}


	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).append(
				this.answerId).toString();
	}

}
